function y = respond(file, x, fis, Range)
    % 配置 fis 输入输出范围
    % fis.Inputs(1).Range = Range.e;
    % fis.Inputs(2).Range = Range.ec;
    % Range.Kp = mean(Range.Kp) + diff(Range.Kp) / 2 * x(1) .* [-1 1];
    % Range.Ki = mean(Range.Ki) + diff(Range.Ki) / 2 * x(1) .* [-1 1];
    % Range.Kd = mean(Range.Kd) + diff(Range.Kd) / 2 * x(1) .* [-1 1];
    Range.Kp = x(1).*(1+x(4).*[-1 1]);
    Range.Ki = x(2).*(1+x(5).*[-1 1]);
    Range.Kd = x(3).*(1+x(6).*[-1 1]);
    fis.Outputs(1).Range = Range.Kp;
    fis.Outputs(2).Range = Range.Ki;
    fis.Outputs(3).Range = Range.Kd;
    
    % e = linspace(Range.e(1), Range.e(2), 7);
    % ec = linspace(Range.ec(1), Range.ec(2), 7);
    Kp = linspace(Range.Kp(1), Range.Kp(2), 7);
    Ki = linspace(Range.Ki(1), Range.Ki(2), 7);
    Kd = linspace(Range.Kd(1), Range.Kd(2), 7);
    
    % 重新调整隶属度函数的范围
    for i = 1:7
        % fis.Inputs(1).mf(i).Parameters = e(i) + [-diff(Range.e) / 6 0 diff(Range.e) / 6];
        % fis.Inputs(2).mf(i).Parameters = ec(i) + [-diff(Range.ec) / 6 0 diff(Range.ec) / 6];
        fis.Outputs(1).mf(i).Parameters = Kp(i) + [-diff(Range.Kp) / 6,0,diff(Range.Kp) / 6];
        fis.Outputs(2).mf(i).Parameters = Ki(i) + [-diff(Range.Ki) / 6,0,diff(Range.Ki) / 6];
        fis.Outputs(3).mf(i).Parameters = Kd(i) + [-diff(Range.Kd) / 6,0,diff(Range.Kd) / 6];
    end  
    
    % 将 fis 对象放入基准工作空间
    assignin('base', 'fis', fis);
    
    % 设置模糊控制器
    set_param('danji_fuzzy/fuzzy_controller', 'FIS', 'fis');%放入工作空间才能写入
    
    % 运行 Simulink 模型并读取结果
    result = sim([file, '.slx'],[0 50]);
    p = result.ScopeData1.signals.values; % 压力
    t = result.tout; % 时间
    %set_point = str2double(get_param([file, '/goal'], 'value')); % 控制目标值
    set_point = 23;
    S = stepinfo(p,t,set_point,'SettlingTimeThreshold',0.01);
    stable_time = S.TransientTime;%调整时间
    it = find(abs(t-stable_time)<0.1);
    ave_error = mean(abs(p(it(end):end)-set_point));%稳态误差的平均值
    y = [1./ave_error  1./stable_time];
end

